﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    mc:Ignorable="d"
					xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
	<!-- Resource dictionary entries should be defined here. -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Colors.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type MenuItem}">
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="Foreground">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Padding" Value="7,2,8,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Padding" Value="7,2,8,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Padding" Value="2,3,2,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Padding" Value="2,3,2,3"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="MouseOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="true" Height="20">
            <Rectangle x:Name="Bg">
                <Rectangle.Fill>
                    <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                </Rectangle.Fill>
            </Rectangle>
            <ContentPresenter Content="{TemplateBinding Header}" RecognizesAccessKey="True" Margin="5,1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            <Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="false" HorizontalOffset="1" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Bottom" VerticalOffset="-1">
                <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
                    <ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                        <ScrollViewer x:Name="SubMenuScrollViewer" CanContentScroll="true" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
                                    <Rectangle Height="{Binding ActualHeight, ElementName=SubMenuBorder}" Width="{Binding ActualWidth, ElementName=SubMenuBorder}">
                                        <Rectangle.Fill>
                                            <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </Canvas>
                                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
                            </Grid>
                        </ScrollViewer>
                    </ContentControl>
                </Microsoft_Windows_Themes:SystemDropShadowChrome>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
            </Trigger>
            <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Trigger.ExitActions>
                    <BeginStoryboard x:Name="MouseOut_BeginStoryboard" Storyboard="{StaticResource MouseOut}"/>
                </Trigger.ExitActions>
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="MouseIn_BeginStoryboard" Storyboard="{StaticResource MouseIn}"/>
                </Trigger.EnterActions>
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="true">
                <Setter Property="Fill" TargetName="Bg">
                    <Setter.Value>
                	 	<SolidColorBrush Color="{StaticResource Application_Menu_Background_Move}"/>
					</Setter.Value>
				</Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="MouseOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="true" Height="20">
            <Rectangle x:Name="Bg">
                <Rectangle.Fill>
                    <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                </Rectangle.Fill>
            </Rectangle>
            <ContentPresenter Content="{TemplateBinding Header}" RecognizesAccessKey="True" Margin="5,1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
                <Trigger.ExitActions>
                    <BeginStoryboard x:Name="MouseOut_BeginStoryboard" Storyboard="{StaticResource MouseOut}"/>
                </Trigger.ExitActions>
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="MouseIn_BeginStoryboard" Storyboard="{StaticResource MouseIn}"/>
                </Trigger.EnterActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <StreamGeometry x:Key="Checkmark">M0,3L3,7 8,0</StreamGeometry>
    <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Glyph">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Control_BorderBrush_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(Popup.IsOpen)" Storyboard.TargetName="PART_Popup">
                	<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="MouseOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Glyph">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
                <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(Popup.IsOpen)" Storyboard.TargetName="PART_Popup">
                	<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="true" Height="20">
            <Rectangle x:Name="Bg">
                <Rectangle.Fill>
                    <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                </Rectangle.Fill>
            </Rectangle>
            <Grid Margin="2,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="12"/>
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="37"/>
                    <ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="17"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter Grid.Column="2" Content="{TemplateBinding Header}" RecognizesAccessKey="True" Margin="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <Border CornerRadius="3" Height="12" Width="12" Grid.Column="5" d:LayoutOverrides="GridBox">
                    <Path x:Name="Glyph" Grid.Column="5" Data="{StaticResource RightArrow}" Margin="4,0,0,0" VerticalAlignment="Center">
                        <Path.Fill>
                            <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
                        </Path.Fill>
                    </Path>
                </Border>
            </Grid>
            <Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="false" HorizontalOffset="-2" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Right" VerticalOffset="-3">
                <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
                    <ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                        <ScrollViewer x:Name="SubMenuScrollViewer" CanContentScroll="true" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
                                    <Rectangle Height="{Binding ActualHeight, ElementName=SubMenuBorder}" Width="{Binding ActualWidth, ElementName=SubMenuBorder}">
                                        <Rectangle.Fill>
                                            <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </Canvas>
                                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
                            </Grid>
                        </ScrollViewer>
                    </ContentControl>
                </Microsoft_Windows_Themes:SystemDropShadowChrome>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
            </Trigger>
            <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
            	<Trigger.ExitActions>
            		<BeginStoryboard x:Name="MouseOut_BeginStoryboard" Storyboard="{StaticResource MouseOut}"/>
            	</Trigger.ExitActions>
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="MouseIn_BeginStoryboard" Storyboard="{StaticResource MouseIn}"/>
                </Trigger.EnterActions>
            </Trigger>
            <!--<Trigger Property="IsSubmenuOpen" Value="true">
                <Setter Property="Fill" TargetName="Bg">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Background_Move}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Fill" TargetName="Glyph">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Move}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Move}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>-->
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Fill" TargetName="Glyph">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseIn">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="Glyph">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="InputGesture">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="MouseOut">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Bg">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Background_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.4" Value="{StaticResource Application_Menu_Background}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="Glyph">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="InputGesture">
                    <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Application_Menu_Foreground_Move}"/>
                    <EasingColorKeyFrame KeyTime="0:0:0.2" Value="{StaticResource Application_Menu_Foreground}"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="true" Height="20">
            <Rectangle x:Name="Bg">
                <Rectangle.Fill>
                    <SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
                </Rectangle.Fill>
            </Rectangle>
            <Grid Margin="2,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="12"/>
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="37"/>
                    <ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="17"/>
                </Grid.ColumnDefinitions>
                <Border x:Name="GlyphPanel" CornerRadius="3" Height="17" Margin="1" Visibility="Hidden" Width="12">
                    <Path x:Name="Glyph" Data="{StaticResource Checkmark}" FlowDirection="LeftToRight" Height="10" Width="10">
                        <Path.Stroke>
                            <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
                        </Path.Stroke>
                    </Path>
                </Border>
                <ContentPresenter Grid.Column="2" Content="{TemplateBinding Header}" RecognizesAccessKey="True" Margin="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <TextBlock x:Name="InputGesture" Grid.Column="4" Margin="1" FontFamily="Segoe UI" Text="{TemplateBinding InputGestureText}" d:IsHidden="True">
            	    <TextBlock.Foreground>
            		    <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
            	    </TextBlock.Foreground>
                </TextBlock>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="True">
                <Trigger.ExitActions>
                    <BeginStoryboard x:Name="MouseOut_BeginStoryboard" Storyboard="{StaticResource MouseOut}"/>
                </Trigger.ExitActions>
                <Trigger.EnterActions>
                    <BeginStoryboard x:Name="MouseIn_BeginStoryboard" Storyboard="{StaticResource MouseIn}"/>
                </Trigger.EnterActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="True">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Foreground" TargetName="InputGesture">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Stroke" TargetName="Glyph">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Foreground" TargetName="InputGesture">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Stroke" TargetName="Glyph">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource Application_Menu_Foreground_Disabled}"/>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
    <Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>

    <Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
        <Setter Property="ClickMode" Value="Hover"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <DockPanel Background="Transparent" SnapsToDevicePixels="true">
                        <Rectangle x:Name="R1" DockPanel.Dock="Right" Fill="Transparent" Width="1"/>
                        <Rectangle x:Name="B1" DockPanel.Dock="Bottom" Fill="Transparent" Height="1"/>
                        <Rectangle x:Name="L1" DockPanel.Dock="Left" Fill="Transparent" Width="1"/>
                        <Rectangle x:Name="T1" DockPanel.Dock="Top" Fill="Transparent" Height="1"/>
                        <ContentPresenter x:Name="ContentContainer" HorizontalAlignment="Center" Margin="2,2,2,2" VerticalAlignment="Center"/>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                            <Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                            <Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                            <Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                            <Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
    
    <Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Column="0" Grid.Row="1">
                            <ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
                        </Border>
                        <RepeatButton Grid.Column="0" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="{x:Static ScrollBar.LineUpCommand}" Focusable="false" Grid.Row="0" Style="{StaticResource MenuScrollButton}">
                            <RepeatButton.Visibility>
                                <MultiBinding ConverterParameter="0" Converter="{StaticResource MenuScrollingVisibilityConverter}" FallbackValue="Visibility.Collapsed">
                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path Data="{StaticResource UpArrow}" Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
                        </RepeatButton>
                        <RepeatButton Grid.Column="0" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="{x:Static ScrollBar.LineDownCommand}" Focusable="false" Grid.Row="2" Style="{StaticResource MenuScrollButton}">
                            <RepeatButton.Visibility>
                                <MultiBinding ConverterParameter="100" Converter="{StaticResource MenuScrollingVisibilityConverter}" FallbackValue="Visibility.Collapsed">
                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path Data="{StaticResource DownArrow}" Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
                        </RepeatButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
        <Border BorderThickness="1">
        	<Border.BorderBrush>
        		<SolidColorBrush Color="{StaticResource Application_Menu_BorderBrush}"/>
        	</Border.BorderBrush>
        	<Border.Background>
        		<SolidColorBrush Color="{StaticResource Application_Menu_Background}"/>
        	</Border.Background>
            <Grid>
                <Rectangle Fill="#F1F1F1" HorizontalAlignment="Left" Margin="2" RadiusY="2" RadiusX="2" Width="28"/>
                <Rectangle Fill="#E2E3E3" HorizontalAlignment="Left" Margin="30,2,0,2" Width="1"/>
                <Rectangle Fill="White" HorizontalAlignment="Left" Margin="31,2,0,2" Width="1"/>
                <ContentPresenter Grid.ColumnSpan="2" Margin="1,0"/>
            </Grid>
        </Border>
    </ControlTemplate>
</ResourceDictionary>